package com.yanqu.road.logic.activity.biaoju;

import com.yanqu.road.dao.impl.activity.biaoju.BiaoJuConfigImpl;
import com.yanqu.road.entity.activity.ActivityConfig;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.biaoju.BiaoJuEscortBattleLog;
import com.yanqu.road.entity.activity.biaoju.CrossBiaoJuUserRunEscortData;
import com.yanqu.road.entity.activity.biaoju.config.*;
import com.yanqu.road.entity.config.system.NormalWeightItem;
import com.yanqu.road.logic.helper.ActivityHelper;
import com.yanqu.road.logic.helper.WeightHelper;
import com.yanqu.road.pb.activity.BiaoJuProto;
import com.yanqu.road.utils.RandomHelper;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;
import com.yanqu.road.utils.string.StringUtils;

import java.math.BigInteger;
import java.util.*;

public class BiaoJuConfig {
    private ActivityInfo activityInfo;
    private int expGoodsId; //经验道具id
    private int prestigeGoodsId; //声望道具id
    private int bountyGoodsId; //赏金道具id
    private int speedupGoodsId; //加速道具id
    private int refreshGoodsId; //刷新道具id
    private int dayOpenHour; //每日开启时间/H
    private int dayEndHour; //每日结束时间/H![](../../../../../../../../../../Users/HP/Documents/WXWork/1688858262402783/Cache/Image/2024-02/企业微信截图_17083352655413.png)
    private int preSettleTime; //刷新前N分钟结算
    private int escortMin; //押镖时间/min
    private int prepareTime; //准备时间/min,招募时间
    private List<Integer> dayRefreshHighQualityEscortList; //每日刷新高品质押镖时间点/H
    private int highQualityDefine; //该品质以上的算高品质
    private int refreshHighQualityCount; //保底刷新高品质次数
    private Property refreshCost; //刷新消耗
    private int freeRefreshNum = 1;
    private int refreshNumMax = 3;
    private List<Integer> refreshCostList = new ArrayList<>();
    private int dayJoinLimit; //每日参与次数限制
    private int dayJoinRewardLimit; //每日参与奖励次数限制
    private int teamJoinLimit = 2; //组队参与人数限制
    private Property cityBuildReward; //城市投资固定奖励

    private int bestEscortInitCount; //优质标初始数量
    private int maxQuality; //最大品质

    private int teamUserBattleTransform; //队友战力转化
    private int leaderRewardMulti; //队长额外奖励倍数

    private int noticeNum = 100; //公告数量

    private Map<Integer, List<Integer>> highQualityParamMap = new HashMap<>(); //高品质参数;第一镖局--高品质镖单动态生成参数（镖单品质；镖单系数；保底数量|镖单品质；镖单系数；保底数量

    private Map<Integer, BiaoJuCityConfig> cityConfigMap; // 镖局地点配置
    private Map<Integer, BiaoJuDartConfig> dartConfigMap; // 镖局镖车配置
    private Map<Integer, List<NormalWeightItem>> dartRandomListMap = new HashMap<>(); // 镖局镖车随机列表
    private List<BiaoJuEventConfig> eventConfigList; // 镖局事件配置
    private Map<Integer, BiaoJuTitleConfig> titleConfigMap; // 镖局镖师等级配置
    private List<BiaoJuCityRankConfig> cityRankAdditionList; // 镖局地点排名加成
    private Map<Integer, BiaoJuLevelConfig> levelConfigMap; // 镖局等级配置

    private int nowRound; //当前回合
    private long nextRoundTime; //下一回合时间 ms
    private long nowRoundStartTime; //当前回合的起始时间 ms

    private RandomHelper randomHelper = new RandomHelper();

    private Map<String, BiaoJuProto.BiaoJuSyncConfigMsg.Builder> configMsgMap = new HashMap<>();

    public BiaoJuConfig(ActivityInfo activityInfo, Map<String, ActivityConfig> activityConfigMap) {
        this.activityInfo = activityInfo;
        this.expGoodsId = activityConfigMap.get("BIAOJU_ITEM_SCORE").getIntValue();
        this.prestigeGoodsId = activityConfigMap.get("BIAOJU_ITEM_PRESTIGE").getIntValue();
        this.bountyGoodsId = activityConfigMap.get("BIAOJU_ITEM_BOUNTY").getIntValue();
        this.speedupGoodsId = activityConfigMap.get("BIAOJU_ITEM_QUICKEN").getIntValue();
        this.refreshGoodsId = activityConfigMap.get("BIAOJU_ITEM_REFRESH").getIntValue();
        this.dayOpenHour = activityConfigMap.get("BIAOJU_TIME_DAILY_OPEN").getIntValue();
        this.dayEndHour = activityConfigMap.get("BIAOJU_TIME_DAILY_END").getIntValue();
        this.preSettleTime = activityConfigMap.get("BIAOJU_TIME_INCOME").getIntValue();
        this.escortMin = activityConfigMap.get("BIAOJU_TIME_MOVE").getIntValue();
        this.prepareTime = activityConfigMap.get("BIAOJU_TIME_DART_WAIT").getIntValue();
        this.dayRefreshHighQualityEscortList = StringUtils.stringToIntegerList(activityConfigMap.get("BIAOJU_DART_HIGH_QUALITY_REFRESH_TIME_LIST").getValue(), "\\|");
        this.highQualityDefine = activityConfigMap.get("BIAOJU_DART_HIGH_QUALITY_COND").getIntValue();
        if (activityConfigMap.containsKey("BIAOJU_DART_HIGH_HAVE_REFRESH_NUM_MAX")) {
            this.refreshHighQualityCount = activityConfigMap.get("BIAOJU_DART_HIGH_HAVE_REFRESH_NUM_MAX").getIntValue();
        }
        this.refreshCost = PropertyHelper.parseStringToProperty(activityConfigMap.get("BIAOJU_DART_REFRESH_COST").getValue());
        this.dayJoinLimit = activityConfigMap.get("BIAOJU_DAILY_HITCHHIKE_NUM_MAX").getIntValue();
        this.dayJoinRewardLimit = activityConfigMap.get("BIAOJU_DAILY_HITCHHIKE_REWARDS_NUM_MAX").getIntValue();
        this.cityBuildReward = PropertyHelper.parseStringToProperty(activityConfigMap.get("BIAOJU_ITEM_BOUNTY_REWARDS_GAME").getValue());
        this.teamJoinLimit = activityConfigMap.get("BIAOJU_DART_PEOPLE_NUM_MAX").getIntValue();
        this.teamUserBattleTransform = activityConfigMap.get("BIAOJU_DAILY_HITCHHIKE_POWER_PARAM").getIntValue();
        this.leaderRewardMulti = activityConfigMap.get("BIAOJU_DAILY_HEAD_REWARDS_WEIGHTS").getIntValue();
        if (activityConfigMap.containsKey("BIAOJU_DART_REFRESH_NUM_FREE")) {
            this.freeRefreshNum = activityConfigMap.get("BIAOJU_DART_REFRESH_NUM_FREE").getIntValue();
        }
//        if (activityConfigMap.containsKey("BIAOJU_DART_REFRESH_NUM_MAX")) {
//            this.refreshNumMax = activityConfigMap.get("BIAOJU_DART_REFRESH_NUM_MAX").getIntValue();
//        }

        if (activityConfigMap.containsKey("BIAOJU_DART_REFRESH_NUM_CONSUME")) {
            List<Integer> list = StringUtils.stringToIntegerList(activityConfigMap.get("BIAOJU_DART_REFRESH_NUM_CONSUME").getValue(), "\\|");
            this.refreshCostList = list;
            this.refreshNumMax = list.size() + this.freeRefreshNum;
        }
        if (activityConfigMap.containsKey("BIAOJU_DART_HIGH_NOTICE_NUM_MAX")) {
            this.noticeNum = activityConfigMap.get("BIAOJU_DART_HIGH_NOTICE_NUM_MAX").getIntValue();
        }

        int activityId = activityInfo.getActivityId();
        this.cityConfigMap = new BiaoJuConfigImpl().getBiaoJuCityConfigMap(activityId);
        this.dartConfigMap = new BiaoJuConfigImpl().getBiaoJuDartConfigMap(activityId);
        for (BiaoJuDartConfig dartConfig : this.dartConfigMap.values()) {
            int quality = dartConfig.getQuality();
            List<NormalWeightItem> weightItemList = this.dartRandomListMap.get(quality);
            if (weightItemList == null) {
                weightItemList = new ArrayList<>();
                this.dartRandomListMap.put(quality, weightItemList);
            }
            weightItemList.add(new NormalWeightItem(BigInteger.valueOf(dartConfig.getId()), dartConfig.getWeights()));

            if (dartConfig.getQuality() > this.maxQuality) {
                this.maxQuality = dartConfig.getQuality();
            }
        }
        this.eventConfigList = new BiaoJuConfigImpl().getBiaoJuEventConfigList(activityId);
        this.titleConfigMap = new BiaoJuConfigImpl().getBiaoJuTitleConfigMap(activityId);
        this.cityRankAdditionList = new BiaoJuConfigImpl().getBiaoJuCityRankConfigList(activityId);
        this.levelConfigMap = new BiaoJuConfigImpl().getBiaoJuLevelConfigMap(activityId);

        for (String s : activityConfigMap.get("BIAOJU_DART_HIGH_QUALITY_PARAM").getValue().split("\\|")) {
            List<Integer> list = StringUtils.stringToIntegerList(s, ";");
            Integer quality = list.get(0);
            this.highQualityParamMap.put(quality, list);
        }
    }

    public ActivityInfo getActivityInfo() {
        return activityInfo;
    }

    public int getActivityId() {
        return activityInfo.getActivityId();
    }

    public int getExpGoodsId() {
        return expGoodsId;
    }

    public int getPrestigeGoodsId() {
        return prestigeGoodsId;
    }

    public int getBountyGoodsId() {
        return bountyGoodsId;
    }

    public int getSpeedupGoodsId() {
        return speedupGoodsId;
    }

    public int getRefreshGoodsId() {
        return refreshGoodsId;
    }

    public int getDayOpenHour() {
        return dayOpenHour;
    }

    public int getDayEndHour() {
        return dayEndHour;
    }

    public int getPreSettleTime() {
        return preSettleTime;
    }

    public long getEscortMinSecondMillions() {
        return escortMin * DateHelper.MINUTE_MILLIONS;
    }

    public long getPrepareTimeSecondMillions() {
        return prepareTime * DateHelper.MINUTE_MILLIONS;
    }

    public List<Integer> getDayRefreshHighQualityEscortList() {
        return dayRefreshHighQualityEscortList;
    }

    public int getHighQualityDefine() {
        return highQualityDefine;
    }

    public int getRefreshHighQualityCount() {
        return refreshHighQualityCount;
    }

    public Property getRefreshCost(int refreshAmount) {
        int multi = getRefreshCostMulti(refreshAmount - freeRefreshNum + 1);
        return new Property(refreshCost).goodCountMultiNum(multi);
    }

    public int getRefreshCostMulti(int num) {
        if (num < 1|| num > refreshCostList.size()) {
            return 1;
        }
        return refreshCostList.get(num - 1);
    }

    public int getDayJoinLimit() {
        return dayJoinLimit;
    }

    public int getDayJoinRewardLimit() {
        return dayJoinRewardLimit;
    }

//    public List<List<Property>> getCityBuildRewardList() {
//        return cityBuildRewardList;
//    }

    public Property getCityBuildReward() {
        return new Property(cityBuildReward);
    }

    public Map<Integer, BiaoJuCityConfig> getCityConfigMap() {
        return cityConfigMap;
    }

    public Map<Integer, BiaoJuDartConfig> getDartConfigMap() {
        return dartConfigMap;
    }

    public BiaoJuDartConfig getDartConfig(int escortDartId) {
        return dartConfigMap.get(escortDartId);
    }

    public Map<Integer, List<NormalWeightItem>> getDartRandomListMap() {
        return dartRandomListMap;
    }

    public List<BiaoJuEventConfig> getEventConfigList() {
        return eventConfigList;
    }

    public Map<Integer, BiaoJuTitleConfig> getTitleConfigMap() {
        return titleConfigMap;
    }

    public List<BiaoJuCityRankConfig> getCityRankAdditionList() {
        return cityRankAdditionList;
    }

    public Map<Integer, BiaoJuLevelConfig> getLevelConfigMap() {
        return levelConfigMap;
    }

    public int calcRound() {
        long currentTime = DateHelper.getCurrentTime();
        long currentSecond = currentTime / 1000;
        if (currentSecond < activityInfo.getBeginTime() || currentSecond >= activityInfo.getEndTime()) {
            return 0;
        }
        if (currentTime < nextRoundTime) {
            return nowRound;
        }
        int day = ActivityHelper.getWhichDayAfterBeginTime(activityInfo);
        long todayZeroSecond = DateHelper.getTodayZeroTimeStamp() / 1000;
        long nextRoundSecond = activityInfo.getBeginTime();
        for (int i = 0; i < dayRefreshHighQualityEscortList.size(); i++) {
            int refreshDayHour = dayRefreshHighQualityEscortList.get(i);//每日的刷新时间点,小时
            nextRoundSecond = todayZeroSecond + refreshDayHour * DateHelper.HOUR_SECONDS;
            if (currentSecond < nextRoundSecond) {
                if (i == 0) {
                    if (day == 1) {
                        this.nowRound = 0;
                    } else {
                        this.nowRound = (day - 1) * 100 + dayRefreshHighQualityEscortList.size();
                    }
                }else {
                    this.nowRound = day * 100 + i;
                }
                this.nextRoundTime = nextRoundSecond * 1000;
                break;
            } else {
                this.nowRoundStartTime = nextRoundSecond * 1000;
            }
        }

        if (currentTime > this.nextRoundTime) {//一天后的第一个刷新时间点
            this.nowRound = day * 100 + dayRefreshHighQualityEscortList.size();
            this.nextRoundTime = (todayZeroSecond + dayRefreshHighQualityEscortList.get(0) * DateHelper.HOUR_SECONDS + DateHelper.DAY_SECONDS) * DateHelper.SECOND_MILLIONS;
        }

        return this.nowRound;
    }

    public int getNowRound() {
        return calcRound();
    }

    /**
     * 本轮结束时间,不能超过每日结束时间
     * @return
     */
    public long getThisRoundEndTime() {
        calcRound();
        long todayZeroTimeStamp = DateHelper.getTodayZeroTimeStamp();
        long dayEndTime = todayZeroTimeStamp + dayEndHour * DateHelper.HOUR_MILLIONS;
        if (nextRoundTime > dayEndTime) {
            return dayEndTime;
        }
        return nextRoundTime;
    }

    /**
     * 下一轮开始时间
     * @return
     */
    public long getNextRoundTime() {
        calcRound();
        return nextRoundTime;
    }

    public long getNowCityRankSettleTime() {
        long settleTime = getThisRoundEndTime() - preSettleTime * DateHelper.MINUTE_MILLIONS;
        return settleTime;
    }

    public long getNextRoundStartTime() {
        long settleTime = getNextRoundTime() - preSettleTime * DateHelper.MINUTE_MILLIONS;
        return settleTime;
    }

    public int getMaxQuality() {
        return maxQuality;
    }

    public int randomOnceEscortDartId(int quality) {
        List<NormalWeightItem> weightItemList = dartRandomListMap.get(quality);
        if (weightItemList == null || weightItemList.isEmpty()) {
            return 0;
        }
        return WeightHelper.getRandomValue(weightItemList).intValue();
    }

    public int randomOnceCityId() {
        List<Integer> cityIdList = new ArrayList<>();
        for (Integer cityId : cityConfigMap.keySet()) {
            if (cityId == 1) {//不能随机城市1
                continue;
            }
            cityIdList.add(cityId);
        }

        int idx = randomHelper.next(cityIdList.size());
        return cityIdList.get(idx);
    }

    public int randomOnceEventId() {
        int idx = randomHelper.next(eventConfigList.size());
        return eventConfigList.get(idx).getId();
    }

    public BiaoJuProto.BiaoJuSyncConfigMsg.Builder getConfigMsg(String language) {
        return configMsgMap.get(language);
    }

    public void setConfigMsg(String language, BiaoJuProto.BiaoJuSyncConfigMsg.Builder builder) {
        configMsgMap.put(language, builder);
    }

    public int getCityRankAddition(int rank) {
        if (rank <= 0) {
            return 0;
        }
        for (BiaoJuCityRankConfig cityRankConfig : cityRankAdditionList) {
            if (rank <= cityRankConfig.getRank()) {
                return cityRankConfig.getIncomeAdd();
            }
        }
        return 0;
    }

    /**
     * 检查的时间是否在本回合
     *
     * @param checkTime 毫秒
     * @return
     */
    public boolean isTimeInNowRound(long checkTime) {
        return checkTime >= nowRoundStartTime && checkTime < nextRoundTime;
    }

    /**
     * 根据镖师等级抽取镖单品质
     */
    public List<Integer> randomDartQualityList(int titleLevel) {
        BiaoJuTitleConfig biaoJuTitleConfig = titleConfigMap.get(titleLevel);
        if (biaoJuTitleConfig == null) {
            return new ArrayList<>();
        }

        int randomCount = biaoJuTitleConfig.getRefreshNum();
        List<Integer> randomList = new ArrayList<>();
        for (int i = 0; i < randomCount; i++) {
            int randomQuality = WeightHelper.getRandomValue(biaoJuTitleConfig.getWeightList()).intValue();
            randomList.add(randomQuality);
        }

        return randomList;
    }

    public List<Integer> randomDartQualityList(int titleLevel, List<Integer> bestQualityList) {
        BiaoJuTitleConfig biaoJuTitleConfig = titleConfigMap.get(titleLevel);
        if (biaoJuTitleConfig == null) {
            return new ArrayList<>();
        }

        int maxBestQuality = 0;
        for (Integer bestQuality : bestQualityList) {
            if (bestQuality > maxBestQuality) {
                maxBestQuality = bestQuality;
            }
        }
        //根据优质镖的品质获得当前的随机范围
        List<NormalWeightItem> weightItemList = new ArrayList<>();
        for (NormalWeightItem weightItem : biaoJuTitleConfig.getWeightList()) {
            if (weightItem.getValue().intValue() > maxBestQuality) {//过滤高于优质镖最高品质的
                continue;
            }
            weightItemList.add(weightItem);
        }

        int randomCount = biaoJuTitleConfig.getRefreshNum();
        List<Integer> randomList = new ArrayList<>();
        if (weightItemList.isEmpty()) {
            for (int i = 0; i < randomCount; i++) {
                randomList.add(maxBestQuality);
            }
        } else {
            for (int i = 0; i < randomCount; i++) {
                int randomQuality = WeightHelper.getRandomValue(weightItemList).intValue();
                randomList.add(randomQuality);
            }
        }

        return randomList;
    }

    /**
     * 不抽优质镖的随机
     */
    public Integer randomDartQualityListExcludeBest(int titleLevel, int minBestQuality) {
        BiaoJuTitleConfig biaoJuTitleConfig = titleConfigMap.get(titleLevel);
        if (biaoJuTitleConfig == null) {
            return 0;
        }

        List<NormalWeightItem> tempWeightList = new ArrayList<>();
        for (NormalWeightItem normalWeightItem : biaoJuTitleConfig.getWeightList()) {
            Integer quality = normalWeightItem.getValue().intValue();
            if (quality >= minBestQuality) {//排除优质镖
                continue;
            }
            tempWeightList.add(normalWeightItem);
        }

        int randomQuality = WeightHelper.getRandomValue(tempWeightList).intValue();
        if (randomQuality == 0) {//随机不到品质,取当前优质镖最低品质-1的品质
            randomQuality = minBestQuality - 1;
        }
        return randomQuality;
    }

    public int getTitlePower(int level) {
        BiaoJuTitleConfig biaoJuTitleConfig = titleConfigMap.get(level);
        if (biaoJuTitleConfig == null) {
            return 0;
        }
        return biaoJuTitleConfig.getPower();
    }

    public int getTeamJoinLimit() {
        return teamJoinLimit;
    }

    /**
     * 根据经验获得商会等级
     */
    public int calcUnionLevel(long exp) {
        int endLevel = 1;
        for (int i = 1; i <= levelConfigMap.size(); i++) {
            BiaoJuLevelConfig biaoJuLevelConfig = levelConfigMap.get(i);
            if (exp < biaoJuLevelConfig.getCost()) {
                break;
            } else {
                endLevel = i;
            }
        }
        return endLevel;
    }

    /**
     * 根据剩余血量计算完成等级
     * 完镖: 击败怪物数 >= 3
     * 半镖: 击败怪物数 == 2
     * 失镖: 击败怪物数 <= 1
     * 数值让判断直接写死
     *
     * @param runEscortData
     * @return
     */
    public int calcEscortFinishLevel(CrossBiaoJuUserRunEscortData runEscortData) {
        int amount = 0; //击败怪物数
        for (BiaoJuEscortBattleLog biaoJuEscortBattleLog : runEscortData.getBattleLogList()) {
            if (biaoJuEscortBattleLog.getRemainBlood() > 0) {
                amount++;
            }
        }
        //剩余血量千分比
//        int remainPer = BigDecimal.valueOf(runEscortData.getRemainBlood()).divide(BigDecimal.valueOf(runEscortData.getBattleValue()), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(1000)).intValue();
//        if (remainPer > 80) {
//            return 1;//完镖
//        }
//        if (remainPer < 20) {
//            return 3;//失镖
//        }
//        return 2;//半镖
        if (amount >= 3) {
            return 1;//完镖
        }
        if (amount == 2) {
            return 2;//半镖
        }
        return 3;//失镖
    }

    /**
     * 根据经验获得镖师等级
     *
     * @param exp
     * @return
     */
    public int calcTitleLevel(long exp) {
        int endLevel = 1;
        for (int i = 1; i <= titleConfigMap.size(); i++) {
            BiaoJuTitleConfig biaoJuTitleConfig = titleConfigMap.get(i);
            if (exp < biaoJuTitleConfig.getCost()) {
                break;
            } else {
                endLevel = i;
            }
        }
        return endLevel;
    }

    /**
     * 计算战斗胜利,千分比,随机一下
     *
     * @param randomCheckValue
     * @return
     */
    public boolean calcBattleWin(int randomCheckValue) {
        int randomValue = randomHelper.next(1000);
        return randomValue <= randomCheckValue;
    }

    public int getUnionLevelAddition(int level) {
        BiaoJuLevelConfig biaoJuLevelConfig = levelConfigMap.get(level);
        if (biaoJuLevelConfig == null) {
            return 0;
        }
        return biaoJuLevelConfig.getIncomeAdd();
    }

    public int getTitleAddition(int level) {
        BiaoJuTitleConfig biaoJuTitleConfig = titleConfigMap.get(level);
        if (biaoJuTitleConfig == null) {
            return 0;
        }
        return biaoJuTitleConfig.getIncomeAdd();
    }

    /**
     * 镖单系数
     *
     * @param quality
     * @return
     */
    public int getHighQualityEscortParam1(int quality) {
        List<Integer> list = highQualityParamMap.get(quality);
        if (list == null) {
            return 0;
        }
        return list.get(1);
    }

    /**
     * 镖单保底数量
     */
    public int getHighQualityEscortMinNum(int quality) {
        List<Integer> list = highQualityParamMap.get(quality);
        if (list == null) {
            return 0;
        }
        return list.get(2);
    }

    /**
     * 获得下一回合的值
     *
     * @return
     */
    public int getNextRound() {
        int tempRound = getNowRound();
        if (tempRound == 0) {
            return 101;
        }
        int num = tempRound % 100;
        int nextNum = num + 1;
        int day = tempRound / 100;
        if (nextNum > dayRefreshHighQualityEscortList.size()) {
            nextNum = 1;
            day++;
        }

        int nextRound = day * 100 + nextNum;

        return nextRound;
    }

    /**
     * 获得上一回合
     *
     * @return
     */
    public int getBeforeRound() {
        int tempRound = getNowRound();
        if (tempRound == 0) {
            return 0;
        }
        int num = tempRound % 100;
        int day = tempRound / 100;
        if (num == 1) {
            if (day == 1) {
                return 0;
            }
            day--;
            num = dayRefreshHighQualityEscortList.size();
        } else {
            num--;
        }
        int beforeRound = day * 100 + num;
        return beforeRound;
    }

    /**
     * 当前回合是否是最后一回合
     *
     * @return
     */
    public boolean isLastRound() {
        calcRound();
        return nextRoundTime / 1000 >= activityInfo.getEndTime();
    }

    public int getTeamUserBattleTransform() {
        return teamUserBattleTransform;
    }

    public int getLeaderRewardMulti() {
        return leaderRewardMulti;
    }

    public boolean isInDayOpenTime() {
        long currentTime = DateHelper.getCurrentTime();
        long todayZeroTimeStamp = DateHelper.getTodayZeroTimeStamp();

        long dayStartTime = todayZeroTimeStamp + dayOpenHour * DateHelper.HOUR_MILLIONS;
        long dayEndTime = todayZeroTimeStamp + dayEndHour * DateHelper.HOUR_MILLIONS;

        return currentTime >= dayStartTime && currentTime < dayEndTime;
    }

    public Set<Integer> getAllDartGear() {
        Set<Integer> gearSet = new HashSet<>();
        for (BiaoJuDartConfig dartConfig : dartConfigMap.values()) {
            gearSet.add(dartConfig.getGear());
        }
        return gearSet;
    }

    public int getFreeRefreshNum() {
        return freeRefreshNum;
    }

    public int getRefreshNumMax() {
        return refreshNumMax;
    }

    public boolean isTodayRound(Integer round) {
        int day = round / 100;
        int nowDay = getNowRound() / 100;
        return day == nowDay;
    }

    public int getNoticeNum() {
        return noticeNum;
    }
}
